package com.ies.ieschool.client.module.academic.view.data;

import com.ies.ieschool.client.module.academic.dto.CourseListGridDTO;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceBooleanField;
import com.smartgwt.client.data.fields.DataSourceIntegerField;
import com.smartgwt.client.data.fields.DataSourceTextField;

/**
 * <p>
 * Title: ระบบการจัดการงานโรงเรียน
 * Description: ตัวเซ็ตค่าให้กับ Data Transfer Object ของหลักสูตร
 * Copyright: Copyright (c) 2554
 * Company: Intelligent Enterprise Software
 * @author Sharif Densumite
 * @version IES 2012
 * @since 3-05-2012
 */

public class CourseData extends DataSource {  
		  
	    private static CourseData instance = null;  
	  
	    public static CourseData getInstance() {  
	        if (instance == null) {  
	            instance = new CourseData("courseDS");  
	        }  
	        return instance;  
	    }  
	  
	    public CourseData(String id) {  
	  
	        setID(id);  
	        setRecordXPath("/List/course");  
	        DataSourceIntegerField pkField = new DataSourceIntegerField("pk");  
	        pkField.setHidden(true);  
	        pkField.setPrimaryKey(true);  
	  
	        DataSourceTextField courseNameField = new DataSourceTextField("courseName");  
	        courseNameField.setRequired(true);  
	  
	        DataSourceTextField classRangeField = new DataSourceTextField("classRange");  
	        classRangeField.setRequired(true);  
	  
	        DataSourceTextField criterionField = new DataSourceTextField("criterion");  
	        criterionField.setRequired(true);  
	          
	        setFields(pkField, courseNameField, classRangeField, criterionField);  
	  
	        setDataURL("ds/test_data/course.data.xml");  
	        setClientOnly(true);  
	    }  
	
}